<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 100%;
            background-color: aqua;
        }

        .jd {
            width: 10%;
            height: 35px;
            line-height: 35px;
            background-color: rgb(217, 122, 6);
            color: aliceblue;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="jd">10%</div>
    </div>
    <button onclick="fn()">点击</button>
    <script>
        function fn() {
            var jdDom = document.querySelector(".box");
            var width = 10;
            var id = setInterval(function (frame) {
                if (width >= 100) {
                    clearInterval(id)
                }
                else {
                    width++;
                    jdDom.style.width = width + "%";
                    jdDom.innerHTML = width * 1 + "%";
                }
            }, 10)

        }
    </script>
</body>

</html>